<template>
  <div  class="Article">
    <div class="Art_info_head">
      <img :src="artDatas.creatorAvatar">
      <div class="Art_info_head_title">
        <div>{{artDatas.stem}}</div>
        <div class="Art_info">{{artDatas.creatorName}} | {{artDatas.createdAt}}</div>
      </div>
    </div>
    <div @click="getDetail()" class="Art_info_content">
      {{ artDatas.content }}
    </div>
    <div class="Art_info_status">
      点赞 {{artDatas.likeCount}} | 浏览 {{artDatas.views}}
    </div>
  </div>
</template>

<script>
export default {
  name:"ArticleDiv",
  props:{
    artDatas:Object
  },
  data() {
    return {
    }
  },
  methods:{
    getDetail(){
      // 无法传递对象
      this.$router.push({
        path:`/ArticleDetail`,
        query:{
            id:this.artDatas.id
        }
      })
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
*{
  cursor:default;
}
.Article{
  width: 100%;
  box-sizing: border-box;
  padding: 10px;
}
  .Art_info_head{
    display: flex;
    flex-direction: row;
    align-items: center;
  }
  .Art_info_content{
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    text-overflow: ellipsis;
    overflow: hidden;
    max-height: 5em;
    margin: 10px 0;
    cursor: pointer;
    font-size: 14px !important;
  }
  .Art_info ,.Art_info_status,.Art_info_content{
    font-size: 12px;
    color:gray;
  }
  img{
    margin-right: 15px;
    width: 2em;
    height: 2em;
    object-fit: contain;
    border-radius: 50%;
  }

</style>
